package com.jinbiao.jdbc;

import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App_Jdbc {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		ApplicationContext content = new ClassPathXmlApplicationContext("application/jdbc_bean.xml");
		Student_Template template = content.getBean(Student_Template.class);
		System.out.println("开始添加记录");
		/*
		 * template.create("zara", 12); template.create("wusong", 13);
		 * template.create("lishi", 43);
		 */

		System.out.println("开始查询全部结果");
		List<Student> list = template.listStudents();

		for (Student student : list) {
			System.out.println("id=" + student.getId());
			System.out.println("name=" + student.getName());
			System.out.println("age=" + student.getAge());
		};

		Student stu = template.getStudent(2);
		System.out.println(stu);
		
		//查看删除信息
		template.delete(2);
		
		//查看更新信息
		template.update(3, 56);
	
	
	
	}
		
		
	

}
